package com.smart.seckilldemo.rocketmq.producer;

import com.smart.seckilldemo.commons.dto.GenerateSeckillOrder;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 发送删除缓存队列
 */

@Component
@Slf4j
public class DeleteCacheProducer {

    @Resource
    RocketMQTemplate rocketMQTemplate;

   private final static String topicStr="tp_delete_cache";
    /**
     *
     * @param msg
     */
    public void onMessage(String msg) {
        //发送删除缓存信息
        rocketMQTemplate.syncSend(topicStr, MessageBuilder.withPayload(msg).build(),1,1);
    }

}
